﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="commonnum.aspx.cs" Inherits="Com.Rivyer.Web.contact.commonnum" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2.Export, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dx" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>常用联系人</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../css/rivcontent.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <%if (DesignMode)
      { %>
    <script type="text/javascript" src="../js/ASPxScriptIntelliSense.js"></script>
    <%} %>
    <script type="text/javascript">
        
    </script>
    <div>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td height="30">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td height="24" bgcolor="#353c44">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td>
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td width="6%" height="19" valign="bottom">
                                                        <div align="center">
                                                            <img src="../images/tb.gif" width="14" height="14" /></div>
                                                    </td>
                                                    <td width="94%" valign="bottom">
                                                        <span class="STYLE1">常用联系人</span>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="center" style="font-size: 12px">
                    <div id="rivcontent">
                        <div class="title">
                            常用联系人</div>
                        <dx:ASPxGridView ID="commoncontact" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                            KeyFieldName="id" Font-Size="12px" Width="750px" OnRowInserted="commoncontact_RowInserted"
                            OnRowUpdated="commoncontact_RowUpdated" 
                            onrowinserting="commoncontact_RowInserting" 
                            onrowupdating="commoncontact_RowUpdating" Settings-ShowFilterRowMenu="True">
                            <Columns>
                                <dx:GridViewCommandColumn Caption="操作" VisibleIndex="0">
                                    <EditButton Text="编辑" Visible="True">
                                    </EditButton>
                                    <NewButton Text="新增" Visible="True">
                                    </NewButton>
                                    <DeleteButton Text="删除">
                                        <Image AlternateText="真的要删除吗?">
                                        </Image>
                                    </DeleteButton>
                                    <CancelButton Text="取消">
                                    </CancelButton>
                                    <UpdateButton Text="更新">
                                    </UpdateButton>
                                </dx:GridViewCommandColumn>
                                <dx:GridViewDataTextColumn Caption="序号" FieldName="id" ReadOnly="True" VisibleIndex="1"
                                    Visible="False">
                                    <EditFormSettings Visible="False" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="部门" FieldName="department" VisibleIndex="2">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="联系人" FieldName="contactname" VisibleIndex="3">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="座机" FieldName="telephonenum" VisibleIndex="4">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="手机" FieldName="mobilephone" VisibleIndex="5">
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <SettingsPager PageSize="15">
                            </SettingsPager>
                            <Settings ShowFilterRowMenu="True" ShowFilterRow="true"/>
                            <Styles>
                                <Header HorizontalAlign="Center">
                                </Header>
                                <Cell HorizontalAlign="Center">
                                </Cell>
                            </Styles>
                        </dx:ASPxGridView>
                        <span class="tips">Tips:</span>1.部门与联系人二者不能同时为空;2.手机与座机二者不能同时为空;3.手机号码正确;4.座机正确;
                        <div style="margin:5px auto auto auto">
                            <dx:ASPxButton ID="btn_export" runat="server" Text="导出数据" 
                                onclick="btn_export_Click">
                            </dx:ASPxButton>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ITConnectionString %>"
        DeleteCommand="DELETE FROM [tb_commoncontact] WHERE [id] = @id" InsertCommand="INSERT INTO [tb_commoncontact] ([department], [contactname], [telephonenum], [mobilephone]) VALUES (@department, @contactname, @telephonenum, @mobilephone)"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT [id], [department], [contactname], [telephonenum], [mobilephone] FROM [tb_commoncontact]"
        UpdateCommand="UPDATE [tb_commoncontact] SET [department] = @department, [contactname] = @contactname, [telephonenum] = @telephonenum, [mobilephone] = @mobilephone WHERE [id] = @id">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="department" Type="String" />
            <asp:Parameter Name="contactname" Type="String" />
            <asp:Parameter Name="telephonenum" Type="String" />
            <asp:Parameter Name="mobilephone" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="department" Type="String" />
            <asp:Parameter Name="contactname" Type="String" />
            <asp:Parameter Name="telephonenum" Type="String" />
            <asp:Parameter Name="mobilephone" Type="String" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="commoncontact">
    </dx:ASPxGridViewExporter>
    </form>
</body>
</html>
